import request from "@/api/config";
import { AxiosPromise } from 'axios';
import {PORT} from "@/leadmall/api/config/servicePort";
import { AdminGroupVO, AdminGroupForm, AdminGroupQuery } from '@/leadmall/api/adminGroup/types';

/**
 * 查询员工权限分组列表
 * @param query
 * @returns {*}
 */

export const listAdminGroup = (query?: AdminGroupQuery): AxiosPromise<AdminGroupVO[]> => {
  return request({
    url: PORT +'/leadmall/adminGroup/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询员工权限分组详细
 * @param id
 */
export const getAdminGroup = (id: string | number): AxiosPromise<AdminGroupVO> => {
  return request({
    url: PORT +'/leadmall/adminGroup/' + id,
    method: 'get'
  });
};

/**
 * 新增员工权限分组
 * @param data
 */
export const addAdminGroup = (data: AdminGroupForm) => {
  return request({
    url: PORT +'/leadmall/adminGroup',
    method: 'post',
    data: data
  });
};

/**
 * 修改员工权限分组
 * @param data
 */
export const updateAdminGroup = (data: AdminGroupForm) => {
  return request({
    url: PORT +'/leadmall/adminGroup',
    method: 'put',
    data: data
  });
};

/**
 * 删除员工权限分组
 * @param id
 */
export const delAdminGroup = (id: string | number | Array<string | number>) => {
  return request({
    url: PORT +'/leadmall/adminGroup/' + id,
    method: 'delete'
  });
};
